﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A2DFramework.LockService
{
    /// <summary>
    /// 分布式锁服务
    /// </summary>
    public interface ILock
    {
        /// <summary>
        /// 获得锁,没有超时限制
        /// </summary>
        /// <param name="lockName"></param>
        /// <returns></returns>
        A2DLock AcquireLock(string lockName);

        /// <summary>
        /// 获得锁
        /// </summary>
        /// <param name="lockName"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        A2DLock AcquireLock(string lockName, TimeSpan timeout);

        /// <summary>
        /// 释放锁
        /// </summary>
        /// <param name="lockObj"></param>
        void ReleaseLock(A2DLock lockObj);
    }
}
